import { Injectable } from '@nestjs/common';
import { TypeOrmCrudService } from '@nestjsx/crud-typeorm';
import { Users } from './users.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository, Like } from 'typeorm';
import { Format } from '../../common/formatting/format';
@Injectable()
export class UsersService extends TypeOrmCrudService<Account> {
  constructor(
    @InjectRepository(Users)
    repo: Repository<Account>,
    private readonly format: Format
  ) {
    super(repo);
  }

  async findOneByName(name) {
    const filter = [
      {
        userName: name.name,
      },
      {
        account: name.name,
      },
    ];
    return await this.repo.find({
      where: filter,
    });
  }
}
